package com.hoas.comparedb.entity;

import java.util.Objects;

public class TableColumn {

    private String tableSchema;

    private String tableName;

    private String columnName;

    private Integer columnPosition;

    private String columnType;

    private String columnDefault;

    private boolean autoIncr = false;

    private String isNullable;

    private String columnKey;

    private String extra;

    private String columnComment;

    private String characterSetName;

    private String collationName;

    public TableColumn(String tableSchema, String tableName, String columnName) {
        this.tableSchema = tableSchema;
        this.tableName = tableName;
        this.columnName = columnName;
    }

    public TableColumn() {
    }

    public String getTableSchema() {
        return tableSchema;
    }

    public void setTableSchema(String tableSchema) {
        this.tableSchema = tableSchema;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }


    public String getColumnName() {
        return columnName;
    }

    public void setColumnName(String columnName) {
        this.columnName = columnName;
    }

    public Integer getColumnPosition() {
        return columnPosition;
    }

    public void setColumnPosition(Integer columnPosition) {
        this.columnPosition = columnPosition;
    }

    public String getColumnType() {
        return columnType;
    }

    public void setColumnType(String columnType) {
        this.columnType = columnType;
    }

    public String getColumnDefault() {
        return columnDefault;
    }

    public void setColumnDefault(String columnDefault) {
        this.columnDefault = columnDefault;
    }

    public boolean isAutoIncr() {
        return autoIncr;
    }

    public void setAutoIncr(boolean autoIncr) {
        this.autoIncr = autoIncr;
    }

    public String getIsNullable() {
        return isNullable;
    }

    public void setIsNullable(String isNullable) {
        this.isNullable = isNullable;
    }

    public String getColumnKey() {
        return columnKey;
    }

    public void setColumnKey(String columnKey) {
        this.columnKey = columnKey;
    }

    public String getExtra() {
        return extra;
    }

    public void setExtra(String extra) {
        this.extra = extra;
    }

    public String getColumnComment() {
        return columnComment;
    }

    public void setColumnComment(String columnComment) {
        this.columnComment = columnComment;
    }

    public String getCharacterSetName() {
        return characterSetName;
    }

    public void setCharacterSetName(String characterSetName) {
        this.characterSetName = characterSetName;
    }

    public String getCollationName() {
        return collationName;
    }

    public void setCollationName(String collationName) {
        this.collationName = collationName;
    }

    public String getUk() {
        return tableSchema + "." + tableName + "#" + columnName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TableColumn that = (TableColumn) o;
        return Objects.equals(tableName, that.tableName) && Objects.equals(columnName, that.columnName);
    }



    @Override
    public int hashCode() {
        return Objects.hash(tableSchema, tableName, columnName);
    }

}
